﻿using System;

namespace Poly2Tri
{
	// Token: 0x02000411 RID: 1041
	public class Point2D : IComparable<Point2D>
	{
		// Token: 0x06001D12 RID: 7442 RVA: 0x000B45EB File Offset: 0x000B27EB
		public Point2D()
		{
			this.mX = 0.0;
			this.mY = 0.0;
		}

		// Token: 0x06001D13 RID: 7443 RVA: 0x000B4611 File Offset: 0x000B2811
		public Point2D(double x, double y)
		{
			this.mX = x;
			this.mY = y;
		}

		// Token: 0x06001D14 RID: 7444 RVA: 0x000B4627 File Offset: 0x000B2827
		public Point2D(Point2D p)
		{
			this.mX = p.X;
			this.mY = p.Y;
		}

		// Token: 0x1700042B RID: 1067
		// (get) Token: 0x06001D15 RID: 7445 RVA: 0x000B32E5 File Offset: 0x000B14E5
		// (set) Token: 0x06001D16 RID: 7446 RVA: 0x000B4647 File Offset: 0x000B2847
		public virtual double X
		{
			get
			{
				return this.mX;
			}
			set
			{
				this.mX = value;
			}
		}

		// Token: 0x1700042C RID: 1068
		// (get) Token: 0x06001D17 RID: 7447 RVA: 0x000B331E File Offset: 0x000B151E
		// (set) Token: 0x06001D18 RID: 7448 RVA: 0x000B4650 File Offset: 0x000B2850
		public virtual double Y
		{
			get
			{
				return this.mY;
			}
			set
			{
				this.mY = value;
			}
		}

		// Token: 0x1700042D RID: 1069
		// (get) Token: 0x06001D19 RID: 7449 RVA: 0x000B4659 File Offset: 0x000B2859
		public float Xf
		{
			get
			{
				return (float)this.X;
			}
		}

		// Token: 0x1700042E RID: 1070
		// (get) Token: 0x06001D1A RID: 7450 RVA: 0x000B4662 File Offset: 0x000B2862
		public float Yf
		{
			get
			{
				return (float)this.Y;
			}
		}

		// Token: 0x06001D1B RID: 7451 RVA: 0x000B466C File Offset: 0x000B286C
		public override string ToString()
		{
			return string.Concat(new string[]
			{
				"[",
				this.X.ToString(),
				",",
				this.Y.ToString(),
				"]"
			});
		}

		// Token: 0x06001D1C RID: 7452 RVA: 0x000B1856 File Offset: 0x000AFA56
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		// Token: 0x06001D1D RID: 7453 RVA: 0x000B46CC File Offset: 0x000B28CC
		public override bool Equals(object obj)
		{
			Point2D point2D = obj as Point2D;
			if (point2D != null)
			{
				return this.Equals(point2D);
			}
			return base.Equals(obj);
		}

		// Token: 0x06001D1E RID: 7454 RVA: 0x000B46F5 File Offset: 0x000B28F5
		public bool Equals(Point2D p)
		{
			return this.Equals(p, 0.0);
		}

		// Token: 0x06001D1F RID: 7455 RVA: 0x000B4707 File Offset: 0x000B2907
		public bool Equals(Point2D p, double epsilon)
		{
			return p != null && MathUtil.AreValuesEqual(this.X, p.X, epsilon) && MathUtil.AreValuesEqual(this.Y, p.Y, epsilon);
		}

		// Token: 0x06001D20 RID: 7456 RVA: 0x000B4740 File Offset: 0x000B2940
		public int CompareTo(Point2D other)
		{
			if (this.Y < other.Y)
			{
				return -1;
			}
			if (this.Y > other.Y)
			{
				return 1;
			}
			if (this.X < other.X)
			{
				return -1;
			}
			if (this.X > other.X)
			{
				return 1;
			}
			return 0;
		}

		// Token: 0x06001D21 RID: 7457 RVA: 0x000B479A File Offset: 0x000B299A
		public virtual void Set(double x, double y)
		{
			this.X = x;
			this.Y = y;
		}

		// Token: 0x06001D22 RID: 7458 RVA: 0x000B47AA File Offset: 0x000B29AA
		public virtual void Set(Point2D p)
		{
			this.X = p.X;
			this.Y = p.Y;
		}

		// Token: 0x06001D23 RID: 7459 RVA: 0x000B47C4 File Offset: 0x000B29C4
		public void Add(Point2D p)
		{
			this.X += p.X;
			this.Y += p.Y;
		}

		// Token: 0x06001D24 RID: 7460 RVA: 0x000B47EC File Offset: 0x000B29EC
		public void Add(double scalar)
		{
			this.X += scalar;
			this.Y += scalar;
		}

		// Token: 0x06001D25 RID: 7461 RVA: 0x000B480A File Offset: 0x000B2A0A
		public void Subtract(Point2D p)
		{
			this.X -= p.X;
			this.Y -= p.Y;
		}

		// Token: 0x06001D26 RID: 7462 RVA: 0x000B4832 File Offset: 0x000B2A32
		public void Subtract(double scalar)
		{
			this.X -= scalar;
			this.Y -= scalar;
		}

		// Token: 0x06001D27 RID: 7463 RVA: 0x000B4850 File Offset: 0x000B2A50
		public void Multiply(Point2D p)
		{
			this.X *= p.X;
			this.Y *= p.Y;
		}

		// Token: 0x06001D28 RID: 7464 RVA: 0x000B4878 File Offset: 0x000B2A78
		public void Multiply(double scalar)
		{
			this.X *= scalar;
			this.Y *= scalar;
		}

		// Token: 0x06001D29 RID: 7465 RVA: 0x000B4896 File Offset: 0x000B2A96
		public void Divide(Point2D p)
		{
			this.X /= p.X;
			this.Y /= p.Y;
		}

		// Token: 0x06001D2A RID: 7466 RVA: 0x000B48BE File Offset: 0x000B2ABE
		public void Divide(double scalar)
		{
			this.X /= scalar;
			this.Y /= scalar;
		}

		// Token: 0x06001D2B RID: 7467 RVA: 0x000B48DC File Offset: 0x000B2ADC
		public void Negate()
		{
			this.X = -this.X;
			this.Y = -this.Y;
		}

		// Token: 0x06001D2C RID: 7468 RVA: 0x000B48F8 File Offset: 0x000B2AF8
		public double Magnitude()
		{
			return Math.Sqrt(this.X * this.X + this.Y * this.Y);
		}

		// Token: 0x06001D2D RID: 7469 RVA: 0x000B491A File Offset: 0x000B2B1A
		public double MagnitudeSquared()
		{
			return this.X * this.X + this.Y * this.Y;
		}

		// Token: 0x06001D2E RID: 7470 RVA: 0x000B4937 File Offset: 0x000B2B37
		public double MagnitudeReciprocal()
		{
			return 1.0 / this.Magnitude();
		}

		// Token: 0x06001D2F RID: 7471 RVA: 0x000B4949 File Offset: 0x000B2B49
		public void Normalize()
		{
			this.Multiply(this.MagnitudeReciprocal());
		}

		// Token: 0x06001D30 RID: 7472 RVA: 0x000B3E65 File Offset: 0x000B2065
		public double Dot(Point2D p)
		{
			return this.X * p.X + this.Y * p.Y;
		}

		// Token: 0x06001D31 RID: 7473 RVA: 0x000B4957 File Offset: 0x000B2B57
		public double Cross(Point2D p)
		{
			return this.X * p.Y - this.Y * p.X;
		}

		// Token: 0x06001D32 RID: 7474 RVA: 0x000B4974 File Offset: 0x000B2B74
		public void Clamp(Point2D low, Point2D high)
		{
			this.X = Math.Max(low.X, Math.Min(this.X, high.X));
			this.Y = Math.Max(low.Y, Math.Min(this.Y, high.Y));
		}

		// Token: 0x06001D33 RID: 7475 RVA: 0x000B49C5 File Offset: 0x000B2BC5
		public void Abs()
		{
			this.X = Math.Abs(this.X);
			this.Y = Math.Abs(this.Y);
		}

		// Token: 0x06001D34 RID: 7476 RVA: 0x000B49EC File Offset: 0x000B2BEC
		public void Reciprocal()
		{
			if (this.X != 0.0 && this.Y != 0.0)
			{
				this.X = 1.0 / this.X;
				this.Y = 1.0 / this.Y;
			}
		}

		// Token: 0x06001D35 RID: 7477 RVA: 0x000B4A4D File Offset: 0x000B2C4D
		public void Translate(Point2D vector)
		{
			this.Add(vector);
		}

		// Token: 0x06001D36 RID: 7478 RVA: 0x000B4A56 File Offset: 0x000B2C56
		public void Translate(double x, double y)
		{
			this.X += x;
			this.Y += y;
		}

		// Token: 0x06001D37 RID: 7479 RVA: 0x000B4A74 File Offset: 0x000B2C74
		public void Scale(Point2D vector)
		{
			this.Multiply(vector);
		}

		// Token: 0x06001D38 RID: 7480 RVA: 0x000B4A7D File Offset: 0x000B2C7D
		public void Scale(double scalar)
		{
			this.Multiply(scalar);
		}

		// Token: 0x06001D39 RID: 7481 RVA: 0x000B4A86 File Offset: 0x000B2C86
		public void Scale(double x, double y)
		{
			this.X *= x;
			this.Y *= y;
		}

		// Token: 0x06001D3A RID: 7482 RVA: 0x000B4AA4 File Offset: 0x000B2CA4
		public void Rotate(double radians)
		{
			double num = Math.Cos(radians);
			double num2 = Math.Sin(radians);
			double x = this.X;
			double y = this.Y;
			this.X = x * num - y * num2;
			this.Y = x * num2 + y * num;
		}

		// Token: 0x06001D3B RID: 7483 RVA: 0x000B4AE8 File Offset: 0x000B2CE8
		public void RotateDegrees(double degrees)
		{
			double radians = degrees * 3.141592653589793 / 180.0;
			this.Rotate(radians);
		}

		// Token: 0x06001D3C RID: 7484 RVA: 0x000B3E65 File Offset: 0x000B2065
		public static double Dot(Point2D lhs, Point2D rhs)
		{
			return lhs.X * rhs.X + lhs.Y * rhs.Y;
		}

		// Token: 0x06001D3D RID: 7485 RVA: 0x000B4957 File Offset: 0x000B2B57
		public static double Cross(Point2D lhs, Point2D rhs)
		{
			return lhs.X * rhs.Y - lhs.Y * rhs.X;
		}

		// Token: 0x06001D3E RID: 7486 RVA: 0x000B4B14 File Offset: 0x000B2D14
		public static Point2D Clamp(Point2D a, Point2D low, Point2D high)
		{
			Point2D point2D = new Point2D(a);
			point2D.Clamp(low, high);
			return point2D;
		}

		// Token: 0x06001D3F RID: 7487 RVA: 0x000B4B34 File Offset: 0x000B2D34
		public static Point2D Min(Point2D a, Point2D b)
		{
			return new Point2D
			{
				X = Math.Min(a.X, b.X),
				Y = Math.Min(a.Y, b.Y)
			};
		}

		// Token: 0x06001D40 RID: 7488 RVA: 0x000B4B78 File Offset: 0x000B2D78
		public static Point2D Max(Point2D a, Point2D b)
		{
			return new Point2D
			{
				X = Math.Max(a.X, b.X),
				Y = Math.Max(a.Y, b.Y)
			};
		}

		// Token: 0x06001D41 RID: 7489 RVA: 0x000B4BBC File Offset: 0x000B2DBC
		public static Point2D Abs(Point2D a)
		{
			return new Point2D(Math.Abs(a.X), Math.Abs(a.Y));
		}

		// Token: 0x06001D42 RID: 7490 RVA: 0x000B4BE8 File Offset: 0x000B2DE8
		public static Point2D Reciprocal(Point2D a)
		{
			return new Point2D(1.0 / a.X, 1.0 / a.Y);
		}

		// Token: 0x06001D43 RID: 7491 RVA: 0x000B4C1C File Offset: 0x000B2E1C
		public static Point2D Perpendicular(Point2D lhs, double scalar)
		{
			return new Point2D(lhs.Y * scalar, lhs.X * -scalar);
		}

		// Token: 0x06001D44 RID: 7492 RVA: 0x000B4C44 File Offset: 0x000B2E44
		public static Point2D Perpendicular(double scalar, Point2D rhs)
		{
			return new Point2D(-scalar * rhs.Y, scalar * rhs.X);
		}

		// Token: 0x06001D45 RID: 7493 RVA: 0x000B4C6C File Offset: 0x000B2E6C
		public static Point2D operator +(Point2D lhs, Point2D rhs)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Add(rhs);
			return point2D;
		}

		// Token: 0x06001D46 RID: 7494 RVA: 0x000B4C88 File Offset: 0x000B2E88
		public static Point2D operator +(Point2D lhs, double scalar)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Add(scalar);
			return point2D;
		}

		// Token: 0x06001D47 RID: 7495 RVA: 0x000B4CA4 File Offset: 0x000B2EA4
		public static Point2D operator -(Point2D lhs, Point2D rhs)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Subtract(rhs);
			return point2D;
		}

		// Token: 0x06001D48 RID: 7496 RVA: 0x000B4CC0 File Offset: 0x000B2EC0
		public static Point2D operator -(Point2D lhs, double scalar)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Subtract(scalar);
			return point2D;
		}

		// Token: 0x06001D49 RID: 7497 RVA: 0x000B4CDC File Offset: 0x000B2EDC
		public static Point2D operator *(Point2D lhs, Point2D rhs)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Multiply(rhs);
			return point2D;
		}

		// Token: 0x06001D4A RID: 7498 RVA: 0x000B4CF8 File Offset: 0x000B2EF8
		public static Point2D operator *(Point2D lhs, double scalar)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Multiply(scalar);
			return point2D;
		}

		// Token: 0x06001D4B RID: 7499 RVA: 0x000B4D14 File Offset: 0x000B2F14
		public static Point2D operator *(double scalar, Point2D lhs)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Multiply(scalar);
			return point2D;
		}

		// Token: 0x06001D4C RID: 7500 RVA: 0x000B4D30 File Offset: 0x000B2F30
		public static Point2D operator /(Point2D lhs, Point2D rhs)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Divide(rhs);
			return point2D;
		}

		// Token: 0x06001D4D RID: 7501 RVA: 0x000B4D4C File Offset: 0x000B2F4C
		public static Point2D operator /(Point2D lhs, double scalar)
		{
			Point2D point2D = new Point2D(lhs);
			point2D.Divide(scalar);
			return point2D;
		}

		// Token: 0x06001D4E RID: 7502 RVA: 0x000B4D68 File Offset: 0x000B2F68
		public static Point2D operator -(Point2D p)
		{
			Point2D point2D = new Point2D(p);
			point2D.Negate();
			return point2D;
		}

		// Token: 0x06001D4F RID: 7503 RVA: 0x000B4D83 File Offset: 0x000B2F83
		public static bool operator <(Point2D lhs, Point2D rhs)
		{
			return lhs.CompareTo(rhs) == -1;
		}

		// Token: 0x06001D50 RID: 7504 RVA: 0x000B4D99 File Offset: 0x000B2F99
		public static bool operator >(Point2D lhs, Point2D rhs)
		{
			return lhs.CompareTo(rhs) == 1;
		}

		// Token: 0x06001D51 RID: 7505 RVA: 0x000B4DAF File Offset: 0x000B2FAF
		public static bool operator <=(Point2D lhs, Point2D rhs)
		{
			return lhs.CompareTo(rhs) <= 0;
		}

		// Token: 0x06001D52 RID: 7506 RVA: 0x000B4DC5 File Offset: 0x000B2FC5
		public static bool operator >=(Point2D lhs, Point2D rhs)
		{
			return lhs.CompareTo(rhs) >= 0;
		}

		// Token: 0x04001DC1 RID: 7617
		protected double mX;

		// Token: 0x04001DC2 RID: 7618
		protected double mY;
	}
}
